/*
 * Copyright (c) 2009, Hamish Morgan
 * All rights reserver.
 */
package locusts.common.behaviours;

/**
 * AbstractBehaviour implements Behaviour adding a weight parameter.
 * The weight is used to prioritise the steering of one behaviour over
 * another.
 * 
 * @author Hamish Morgan
 */
public abstract class AbstractBehaviour implements Behaviour {
    
    protected static final double DEFAULT_WEIGHT = 1.0d;
    private double weight;
    
    public AbstractBehaviour(double weight) {
        setWeight(weight);
    }
    
    public AbstractBehaviour() {
        this(DEFAULT_WEIGHT);
    }
    
    public void setWeight(double weight) {
        if (Double.isNaN(weight) || Double.isInfinite(weight))
            throw new IllegalArgumentException();
        this.weight = weight;
    }

    public double getWeight() {
        return weight;
    }

    
    
}
